<template>
  <view class="allContaienr" @click="handleClick">
    <view class="itemContent">
      <text class="itemName">{{ itemObj.interviewTitle }}</text>
      <text class="itemTime">{{ getMdate(itemObj.validStartTime) }} - {{ getMdate(itemObj.validEndTime) }}</text>
      <view class="itemAction">
        <text class="itemResultNum"
          >已回收 <text class="red">{{ itemObj.resultNum ? itemObj.resultNum : 0 }}</text
          >份结果</text
        >
        <view v-if="btnTitle.length" class="itemRightBtn" @click.stop="handleRightBtnClick">{{ btnTitle }}</view>
        <view v-else-if="itemObj.interviewStatus == 'started'" class="itemRightBtn" @click.stop="handleRightBtnClick">邀请面试</view>
        <view v-else class="itemRightBtn" style="color: darkgray">{{ itemObj.interviewStatusName }}</view>
      </view>
    </view>
  </view>
</template>

<script>
import common from '@/api/common.js';
export default {
  props: {
    btnTitle: {
      type: String,
      default: '',
    },

    itemObj: {
      type: Object,
      default: function () {
        return {
          id: '1665531282287673345',
          interviewStatus: 'started',
          interviewStatusName: '已开始',
          interviewTitle: '测试招聘6',
          resultNum: 0,
          validEndTime: 1687665600000,
          validStartTime: 1685923200000,
        };
      },
    },

    // cellTap: {
    //   type: Function,
    //   required: false
    // },
    // interviewBtn: {
    //   type: Function,
    //   required: false
    // },
  },

  data() {
    return {};
  },

  methods: {
    handleClick() {
      // this.cellTap(this.itemObj);
      this.$emit('cellTap', this.itemObj);
    },

    handleRightBtnClick() {
      // this.interviewBtn(this.itemObj);
      this.$emit('interviewBtn', this.itemObj);
    },

    getMdate(date) {
      return common.getMinuteTime(date);
    },
  },
};
</script>

<style lang="scss" scoped>
.allContaienr {
  display: flex;
  background: white;
  border-radius: 32rpx;
  justify-content: space-between;
  flex-direction: row;
  padding: 32rpx;
  margin: 32rpx;

  .itemContent {
    display: flex;
    flex-direction: column;
    width: 100%;
    .red {
      font-size: 32rpx;
      color: #f75a3e;
      margin: 0 10rpx;
    }
    .itemName {
      font-size: 32rpx;
      color: #222222;
      font-family: PingFang-SC-Heavy, PingFang-SC;
      font-weight: 800;
    }
    .itemResultNum {
      margin-top: 16rpx;
      font-size: 28rpx;
      color: #555555;
    }

    .itemTime {
      margin-top: 16rpx;
      font-size: 28rpx;
      color: #555555;
    }
    .itemAction {
      display: flex;
      flex-direction: row;
      justify-content: space-between;
    }
  }

  .itemRightBtn {
    display: flex;
    align-items: flex-end;
    font-size: 28rpx;
    color: #f75a3e;
  }
}
</style>
